package ahut2020.exp12;

public class MantHall {
    public static void main(String[] args) {
        int a[] = new int[]{0, 0, 1};
        int win = 0;
        for (int i = 0; i < 10000000; i++) {
            shuffle(a);
            if (a[1] != 0) {
                int t = a[2];
                a[2] = a[1];
                a[1] = t;
            }
            if (a[2] == 1)//change to C
                ++win;

        }
        System.out.println(win);

    }

    static void shuffle(int[] a) {
        for (int i = 0; i < a.length; i++) {
            int j = (int) (Math.random() * (a.length - i)) + i;//j~U[i,n）
            int t = a[i];
            a[i] = a[j];
            a[j] = t;
        }
    }

}
